package com.ice.ubt.greendao;

import android.content.Context;

import com.ice.ubt.event.DaoMaster;

import com.ice.ubt.event.DaoMaster;

import org.greenrobot.greendao.database.Database;

/**
 * Created by HY on 2016/11/3.
 */

public class MyOpenHelper extends DaoMaster.OpenHelper {
    public MyOpenHelper(Context context, String name) {
        super(context, name);
    }


    @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
//        kLog.w("db version update from " + oldVersion + " to " + newVersion);

        switch (oldVersion) {
            case 1:
                //不能先删除表，否则数据都没了
//                PlanDao.dropTable(db, true);

                //PlanTestDao.createTable(db, true);

                // 加入新字段 score
                db.execSQL("ALTER TABLE 'STUDENT' ADD 'SCORE' TEXT;");
                break;
        }

    }
}
